<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script src="xhr.js"></script>
  <script>
    var xhr = getXhr();

    xhr.onreadystatechange = function(){
      if(xhr.readyState == 4){
        alert(xhr.responseText);
      };
    };
    //open()方法的 参数3：异步(true) 同步(false)
    xhr.open('get','/api/async', false);
    xhr.send();
  </script>
  <img src="14.jpg" alt="">
</body>
</html>